package com.zwps.biz.controller.http;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.zwps.biz.api.model.dto.mointordentify.MointorCountVO;
import com.zwps.biz.api.model.dto.mointordentify.MonitorAlarmRecordIdentifyDTO;
import com.zwps.biz.api.model.dto.mointordentify.MonitorUpdateDTO;
import com.zwps.biz.api.model.vo.mointordentify.MonitDentifyListVO;
import com.zwps.biz.api.model.vo.mointordentify.MonitDentifyTrendVO;
import com.zwps.biz.api.model.vo.mointordentify.MonitDentigyTypeVO;
import com.zwps.biz.api.model.vo.mointordentify.MonitorAlarmRecordIdentifyVO;
import com.zwps.biz.api.model.vo.monitorvideo.MonitorDeviceRecordVideoVO;
import com.zwps.biz.api.model.vo.pubpointall.PubPointCountVO;
import com.zwps.biz.domain.service.MonitorAlarmRecordIdentifyService;
import com.zwps.common.controller.response.message.ResponseMessage;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;
import javax.validation.constraints.NotNull;
import java.util.List;

@RestController
@Validated
@RequestMapping("four_chaos/incident")
public class MonitorAlarmRecordIdentifyController {

    @Autowired
    private MonitorAlarmRecordIdentifyService service;

    @Tag(name = "水库四乱")
    @Operation(summary = "事件统计")
    @PostMapping("counts")
    public List<MonitorAlarmRecordIdentifyVO> getVodeos(@Valid @NotNull  @RequestBody MointorCountVO countVO) {
        return service.getCount(countVO);
    }


    @Tag(name = "水库四乱")
    @Operation(summary = "事件详细")
    @PostMapping("detailed")
    public IPage<MonitDentifyListVO> getIdentify(@Valid @NotNull  @RequestBody MonitorAlarmRecordIdentifyDTO identifyDTO) {
        return service.getIdentify(identifyDTO);
    }

    @Tag(name = "水库四乱")
    @Operation(summary = "事件名下拉框")
    @GetMapping("types_name")
    public List<MonitDentigyTypeVO> getTypes() {
        return service.getTypes();
    }

    @Tag(name = "水库四乱")
    @Operation(summary = "监控名下拉框")
    @GetMapping("types_monitorName")
    public List<MonitDentigyTypeVO> getMonitorTypes() {
        return service.getMonitorTypes();
    }

    @Tag(name = "水库四乱")
    @Operation(summary = "近一个月事件识别趋势")
    @PostMapping("incident_trend")
    public  List<MonitDentifyTrendVO> getTrend(@Valid @NotNull  @RequestBody MointorCountVO countVO) {
        return service.getTrend(countVO);
    }
    @Tag(name = "水库四乱")
    @Operation(summary = "最新识别事件动态")
    @GetMapping("recently")
    public List<MonitDentifyListVO> getRecently() {
        return service.getRecently();
    }


    @Tag(name = "水库四乱")
    @Operation(summary = "根据识别类型获取事件")
    @PostMapping("event")
    public IPage<MonitDentifyListVO> getVideo(@Valid @NotNull  @RequestBody MonitorAlarmRecordIdentifyDTO dto)  {
        return service.getEvent(dto);
    }

    @Tag(name = "水库四乱")
    @Operation(summary = "根据报警id获取事件")
    @GetMapping("eventByAramId/{id}")
    public MonitDentifyListVO getVideo(@Valid @NotNull  @PathVariable("id") String id)  {
        return service.getEventByAramId(id);
    }
    @Tag(name = "水库四乱")
    @Operation(summary = "根据报警id识别种类修改状态")
    @PutMapping("update/status")
    public boolean updateById(@Valid @NotNull  @RequestBody MonitorUpdateDTO dto)  {

        return service.updateOfId(dto);


    }

    @Tag(name = "水库四乱")
    @Operation(summary = "事件统计")
    @GetMapping("countsDevice")
    public  List<PubPointCountVO> countsDevice(String deviceType) {
        return service.countsDevice(deviceType);
    }

}
